//
//  GYUserLoginTopView.m
//  research
//
//  Created by 章鱼 on 17/3/28.
//  Copyright © 2017年 simon. All rights reserved.
//

#import "GYUserLoginTopView.h"

@interface GYUserLoginTopView ()


@end

@implementation GYUserLoginTopView

- (instancetype)init {
    
    self = [super init];
    if (self) {
        [self creatPreLiveViewUI];
    }
    return self;
}

- (instancetype)initWithFrame:(CGRect)frame {
    
    self = [super initWithFrame:frame];
    if (self) {
        [self creatPreLiveViewUI];
    }
    return self;
}

- (void)dealloc {
    
}

- (void)drawRect:(CGRect)rect {
    [super drawRect:rect];
}
- (void)layoutSublayersOfLayer:(CALayer *)layer {
    [super layoutSublayersOfLayer:layer];
    
}
- (void)creatPreLiveViewUI {
    _backgroundView = [[UIImageView alloc] init];
    [self addSubview:_backgroundView];
    _backgroundView.image = [UIImage imageNamed:@"personal center_img_backgroud"];
    _backgroundView.userInteractionEnabled = YES;
    
    _pictureView = [[UIImageView alloc] init];
    [_backgroundView addSubview:_pictureView];
    _pictureView.layer.cornerRadius = 32.5f*ADJUST_SCREEN_HEIGHT_SCALE;
    _pictureView.layer.masksToBounds = YES;
    _pictureView.userInteractionEnabled = YES;
    _pictureView.contentMode = UIViewContentModeScaleToFill;
    _pictureView.image = [UIImage imageNamed:@"personal center_icon_avatar_sign in"];
    
    _nameView = [[UIImageView alloc] init];
    [_backgroundView addSubview:_nameView];
    _nameView.image = [UIImage imageNamed:@"personal center_icon_gender"];
    
    _nameLable = [[UILabel alloc] init];
    [_backgroundView addSubview:_nameLable];
    _nameLable.font = [UIFont systemFontOfSize:15];
    _nameLable.textColor = [UIColor whiteColor];
    
    _locationView = [[UIImageView alloc] init];
    [_backgroundView addSubview:_locationView];
    _locationView.image = [UIImage imageNamed:@"personal center_icon_location"];
    
    _locationLable = [[UILabel alloc] init];
    [_backgroundView addSubview:_locationLable];
    _locationLable.font = [UIFont systemFontOfSize:15];
    _locationLable.textColor = [UIColor whiteColor];
    
    [_backgroundView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(0.f);
        make.left.mas_equalTo(0.f);
        make.right.mas_equalTo(0.f);
        make.bottom.mas_equalTo(0.f);
        
    }];
    
    [_pictureView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(40.f);
        make.left.mas_equalTo(61.f);
        make.size.mas_equalTo(CGSizeMake(65*ADJUST_SCREEN_HEIGHT_SCALE, 65*ADJUST_SCREEN_HEIGHT_SCALE));
        
    }];
    
    [_nameView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(45.f);
        make.left.mas_equalTo(_pictureView.mas_right).offset(28.f);
        
    }];
    [_nameLable mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(_nameView.mas_centerY);
        make.left.mas_equalTo(_nameView.mas_right).offset(10.f);
    }];
    
    [_locationView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_nameView.mas_bottom).offset(13.f);
        make.left.mas_equalTo(_pictureView.mas_right).offset(28.f);
        
    }];
    [_locationLable mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(_locationView.mas_centerY);
        make.left.mas_equalTo(_locationView.mas_right).offset(10.f);
    }];
    
}

@end
